home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazine 28 Bonus / CDRomMagazine-SoftKey-ArtPassion-FrenchVersion-Win31Mac.bin / data / crcolpl.dir / 00100_Script_SQUARE GAME < prev    next >
Text File  |  1996-05-03  |  5KB  |  161 lines

  1. -- --------------------------------------------------
  2. -- Handler changeSquareColor changes the color of the sprites
  3. -- in the given spriteList to a random color if the
  4. -- user did not choose a color from the pallete and
  5. -- to the selected color if the user chose a color
  6. -- from the pallete.
  7.  
  8. on changeSquareColor spriteList
  9.   global palleteFlag, color
  10.   
  11.   if palleteFlag = FALSE then
  12.     set color = random(255)
  13.   end if
  14.   
  15.   repeat with i = 1 to count(spriteList)
  16.     set theSprite = getAt(spriteList,i)
  17.     set the backColor of sprite theSprite = value(color)
  18.     set the foreColor of sprite theSprite = value(color)
  19.   end repeat
  20.   
  21.   set palleteFlag = FALSE
  22.   updateStage
  23. end
  24.  
  25. -- --------------------------------------------------
  26. -- Handler setColor sets the color to the color the
  27. -- user chose from the pallete and sets the global
  28. -- variable palleteFlag to TRUE so changeColor
  29. -- will use the chosen color and not a random color.
  30.  
  31. on setColor clickedSprite
  32.   global color, pointerHeight, palleteFlag, arrowSprite
  33.   
  34.   set palleteFlag = TRUE
  35.   set  color = the name of cast the castNum of sprite clickedSprite
  36.   set pointerLoc = the left of sprite clickedSprite + (the width of sprite clickedSprite / 2)
  37.   set the locH of sprite arrowSprite = pointerLoc
  38.   updateStage
  39. end
  40.  
  41. -- --------------------------------------------------
  42. -- Handler setArrowSprite sets the sprite of the
  43. -- arrow used in the square game.
  44.  
  45. on setArrowSprite
  46.   global arrowSprite
  47.   set arrowSprite = 37
  48. end
  49.  
  50. -- --------------------------------------------------
  51. -- Handler setSquareSprites sets the sprites of the
  52. -- squares
  53.  
  54. on setSquareSprites
  55.   global rightSquare, leftSquare, little1, little2
  56.   
  57.   set leftSquare = 3
  58.   set rightSquare = 4
  59.   set little1 = 5
  60.   set little2 = 6
  61. end
  62.  
  63. -- --------------------------------------------------
  64. -- Handler setSquareGamePuppets sets the puppets of the
  65. -- squares and the arrow to true
  66.  
  67. on setSquareGamePuppets val
  68.   global rightSquare, leftSquare, little1, little2, arrowSprite
  69.   
  70.   puppetSprite rightSquare, val
  71.   puppetSprite leftSquare, val
  72.   puppetSprite little1, val
  73.   puppetSprite little2, val
  74.   puppetSprite arrowSprite, val
  75. end
  76.  
  77. -- --------------------------------------------------
  78. -- Handler setInSquareGame is called when the user
  79.  
  80. on setInSquareGame val
  81.   global inSquareGame
  82.   set inSquareGame = val
  83. end
  84.  
  85. -- --------------------------------------------------
  86. -- Handler initializeColor initializes the global
  87. -- variable color to white.
  88.  
  89. on initializeColor
  90.   global color
  91.   set color = 0
  92. end
  93.  
  94. -- --------------------------------------------------
  95. -- Handler initializePalleteFlag initializes the global
  96. -- variable palleteFlag to FALSE.
  97.  
  98. on initializePalleteFlag
  99.   global palleteFlag
  100.   set palleteFlag = FALSE
  101. end
  102.  
  103. -- --------------------------------------------------
  104. -- Handler initializeSquareGame sets the game ready to be
  105. -- played.
  106.  
  107. on initializeSquareGame
  108.   --  preloadSquareGameCasts
  109.   setInSquareGame(TRUE)
  110.   setSquareSprites
  111.   setArrowSprite
  112.   setSquareGamePuppets(TRUE)
  113.   initializeColor
  114.   initializePalleteFlag
  115. end
  116.  
  117. -- --------------------------------------------------
  118. -- Handler endSquareGame is called when the user
  119. -- quits playing the square game. It turns off the
  120. -- puppets set in the game.
  121.  
  122. on endSquareGame
  123.   setSquareGamePuppets(FALSE)
  124.   setInSquareGame(FALSE)
  125. end
  126.  
  127. -- --------------------------------------------------
  128. -- Handler preloadSquareGameCasts 
  129. --on preloadSquareGameCasts
  130. --  waitCursor
  131. --  preLoadCast the number of cast "5"
  132. --  preLoadCast the number of cast "149"
  133. --  preLoadCast the number of cast "125"
  134. --  preLoadCast the number of cast "188"
  135. --  preLoadCast the number of cast "157"
  136. --  preLoadCast the number of cast "150"
  137. --  preLoadCast the number of cast "144"
  138. --  preLoadCast the number of cast "79"
  139. --  preLoadCast the number of cast "12"
  140. --  preLoadCast the number of cast "0"
  141. --  preLoadCast the number of cast "37"
  142. --  preLoadCast the number of cast "2"
  143. --  preLoadCast the number of cast "44"
  144. --  preLoadCast the number of cast "51"
  145. --  preLoadCast the number of cast "15"
  146. --  preLoadCast the number of cast "58"
  147. --  preLoadCast the number of cast "250"
  148. --  preLoadCast the number of cast "99"
  149. --  preLoadCast the number of cast "135"
  150. --  preLoadCast the number of cast "208"
  151. --  preLoadCast the number of cast "239"
  152. --  preLoadCast the number of cast "204"
  153. --  preLoadCast the number of cast "132"
  154. --  preLoadCast the number of cast "67"
  155. --  preLoadCast the number of cast "34"
  156. --  preLoadCast the number of cast "35"
  157. --  preLoadCast the number of cast "217"
  158. --  preLoadCast the number of cast "179"
  159. --  preLoadCast the number of cast "255"
  160. --  normalCursor
  161. --end